public class HomeWork05 {
    public static void main(String[] args) {
        int[] arr = new int[10];
        int sum = 0;
        for(int i = 0; i < arr.length; i++){
            arr[i] = (int)(Math.random() * 100 + 1);
            sum += arr[i];
        }
        int maxIndex = arr.length - 1;
        int index = -1;
        for(int i = arr.length - 1; i >= 0 ; i--) {
            System.out.print(arr[i] + " ");
            if(arr[maxIndex] < arr[i]){
                maxIndex = i;
            }
            if(arr[i] == 8){
                index = i;
            }
            if(i == 0){
                System.out.println("\n最大值为:" + arr[maxIndex] + "\n"
                        + "平均值为:" + sum / arr.length + "\n"
                        +"8的下标为:" + index);
            }
        }
    }
}
